﻿<%@ Page Title="" Language="C#" MasterPageFile="~/module/Fontend.Master" AutoEventWireup="true" CodeBehind="Contact.aspx.cs" Inherits="mamnontuoitho7.module.Contact"  ValidateRequest="false" %>
<%@ Import Namespace="mamnontuoitho7.AppCode" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
<script language="javascript" type="text/javascript">
    function Capcha_Click() {


        var fullname = trim(document.getElementById("<%= txtFullName.ClientID %>").value);
        var phone = trim(document.getElementById("<%= txtPhone.ClientID %>").value);
        var email = trim(document.getElementById("<%= txtEmail.ClientID %>").value);
        var content = trim(document.getElementById("<%= txtContent.ClientID %>").value);
        var captcha = trim(document.getElementById("<%= txtCaptcha.ClientID %>").value);

        if (fullname == null || fullname == "" || !/<%= ConstantClass.testNameRegular_1 %>/.test(ConvertVietToEng(fullname))) {
            
            alert("Tên không được để trống.\nTên không có số hoặc ký tự đặc biệt");
            document.getElementById("<%= txtFullName.ClientID %>").focus();
            return false;
        }

        if (email == "") {
            alert("Email không được để trống");
            document.getElementById("<%= txtEmail.ClientID %>").focus();
            return false;
        }

        if (email != null && email != "") {
            if (!/<%= ConstantClass.testEmailRegular_1 %>/.test(email)) {
                alert("Không đúng định dạng email.");
                document.getElementById("<%= txtEmail.ClientID %>").focus();
                return false;
            }
        }

        if (phone != null && phone != "") {
            if (!/<%= ConstantClass.testPhoneRegular_1 %>/.test(phone)) {
                alert("Số điện thoại phải có định dạng:\n###### hay +##.##### hay ##.###.##### hay ## ## ##.##.## hay (##) ##.###.##");
                document.getElementById("<%= txtPhone.ClientID %>").focus();
                return false;
            }
        }


        if (content == "") {
            alert("Nôi dung không được để trống");
            document.getElementById("<%= txtEmail.ClientID %>").focus();
            return false;
        }

        if (captcha == "") {
            alert("Mã xác nhận không được để trống");
            document.getElementById("<%= txtCaptcha.ClientID %>").focus();
            return false;
        }
        return true;

    }

    function ConvertVietToEng(textViet) {
        var VietNamChar = new Array("aAeEoOuUiIdDyY",
                                    "áàạảãâấầậẩẫăắằặẳẵ",
                                    "ÁÀẠẢÃÂẤẦẬẨẪĂẮẰẶẲẴ",
                                    "éèẹẻẽêếềệểễ",
                                    "ÉÈẸẺẼÊẾỀỆỂỄ",
                                    "óòọỏõôốồộổỗơớờợởỡ",
                                    "ÓÒỌỎÕÔỐỒỘỔỖƠỚỜỢỞỠ",
                                    "úùụủũưứừựửữ",
                                    "ÚÙỤỦŨƯỨỪỰỬỮ",
                                    "íìịỉĩ",
                                    "ÍÌỊỈĨ",
                                    "đ",
                                    "Đ",
                                    "ýỳỵỷỹ",
                                    "ÝỲỴỶỸ");
        
        for (i = 1; i < VietNamChar.length; i++) {
            for (j = 0; j < VietNamChar[i].length; j++) {

                var str = "textViet.replace(/" + VietNamChar[i][j] + "/g,\"" + VietNamChar[0][i - 1] + "\")";
                textViet = eval(str);
            }
        }
        return textViet;
    }


    function trim(str) {
        return str.replace(/^\s+|\s+$/g, "");
    }
    </script>

<div class="blue">
        <a href="Home.aspx">Trang chủ</a> &raquo; Liên hệ</div>
<form id="form1" runat="server">
    <div class="contact">
        <p class="name"><asp:Label ID="lblShoolName" runat="server" /></p>
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td><img src="../images/fontend/icon-contact-school-h28.png" alt=""/></td>
                <td>Địa chỉ</td>
                <td>: <asp:Label ID="lblAddress" runat="server" /></td>
            </tr>
            <tr>
                <td><img src="../images/fontend/icon-contact-phone-h28.png" alt=""/></td>
                <td class="phone">Điện Thoại</td>
                <td class="phone">: <asp:Label ID="lblPhone" runat="server" /></td>
            </tr>
            <tr>
                <td><img src="../images/fontend/icon-contact-fax-h28.png" alt=""/></td>
                <td>Fax</td>
                <td>: <asp:Label ID="lblFax" runat="server" /></td>
            </tr>
            <tr>
                <td><img src="../images/fontend/icon-contact-email-h28.png" alt=""/></td>
                <td class="email">Email</td>
                <td class="email">: <asp:Label ID="lblEmail" runat="server" /></td>
            </tr>
            <tr>
                <td><img src="../images/fontend/icon-contact-website-h28.png" alt=""/></td>
                <td>Website</td>
                <td>: <asp:Label ID="lblWebsite" runat="server" /></td>
            </tr>
        </table>
    </div>
    <div class="contactline">
        <div class="contactfont ">liên hệ</div>
    </div>
    <div style="clear:both;"></div>

    <asp:Panel ID="Panel1" DefaultButton="btnSendFeebback" runat="server">
        <div class="contactform">
            <p>
                Họ và tên:<span>(*)</span><br />
                <asp:TextBox ID="txtFullName" runat="server" style="width:100%;" MaxLength="80" ></asp:TextBox></p><br />
            <p>
                Email:<span>(*)</span><br />
                <asp:TextBox ID="txtEmail" runat="server" style="width:100%;" MaxLength="100"></asp:TextBox></p><br />
            <p>
                Điện thoại:<br />
                <asp:TextBox ID="txtPhone" runat="server" style="width:100%;" MaxLength="20"></asp:TextBox></p><br />
            <p>
                Nội dung:<span>(*)</span><br />
                <asp:TextBox ID="txtContent" TextMode="MultiLine" runat="server" style="width:100%; height:100px;" MaxLength="1200"></asp:TextBox></p><br />
            <div class="captcha">
                Nhập mã xác nhận:<span>(*)</span><br />
                <div class="captleft">
                    <asp:TextBox ID="txtCaptcha" runat="server" style="width:100%;"></asp:TextBox>
                </div>
                <div class="captright">
                    <asp:Image ID="imgCaptcha" runat="server" Style="height: 20px; margin-right: -5px;" />
                    <asp:ImageButton ID="imbReload" runat="server" Width="22px" 
                        ImageUrl="../images/fontend/icon-reload.png" onclick="imbReload_Click" />
                </div>
                <div class="captsubmit"><asp:Button ID="btnSendFeebback" runat="server" Text="Gửi" CssClass="buttons" 
                    onclick="btnSendFeebback_Click" OnClientClick="return Capcha_Click()"/></div>
            </div>
        </div>
    </asp:Panel>
</form>

</asp:Content>
